<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<div></div>
</body>

</html>

<!-- <script src="./day01作业.js"></script> -->
<script src="./2.js"> </script>
<script>
    // function Person(type, url, params = {}) {
    //     var obj = new XMLHttpRequest()
    //     obj.open(type, url, true)
    //     if (type == 'get') {
    //         obj.send(null)
    //     } else {
    //         obj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // 设置请求头
    //         obj.send(params)
    //     }
    //     obj.onreadystatechange = () => {
    //         if (obj.readyState == 4 && obj.status == 200) {
    //             console.log(JSON.parse(obj.responseText));
    //             return JSON.parse(obj.responseText)
    //         }
    //     }
    // }
    // Person('get','https://api.it120.cc/small4/cms/news/list')



    // var Http = new Person()
    // async  function a(){
    //     let {data:res} = await Http.get('https://api.it120.cc/small4/cms/news/list')
    //     console.log(res);
    // }
    // a()






    // function Person(type, url, params = {}) {
    //     var obj = new XMLHttpRequest()
    //     obj.open(type,url,true)
    //     if(type=='get'){
    //         obj.send(null)
    //     }else{
    //         obj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // 设置请求头
    //         obj.send(params)
    //     }
    //     obj.onreadystatechange=()=>{
    //         if(obj.readyState==4 && obj.status==200){
    //             console.log(JSON.parse(obj.responseText));
    //             return JSON.parse(obj.responseText)
    //         }
    //     }
    // }
    // new Person('get','https://api.it120.cc/small4/cms/news/list')




    // var Http = new Person()
    // async function get(){
    //     let {data:res} = await Http.get('https://api.it120.cc/small4/cms/news/list')
    //     console.log(res);
    // }
    // get()



    function get(){
        let jiang = +new Date('2022/10/20 24:00:00')
        let xian = +new Date()
        let cha = jiang-xian
        let day = parseInt(cha/1000/60/60/24)
        day = day>=10?day:'0'+day
        let shi = parseInt(cha/1000/60/60%24)
        shi = shi>=10?shi:'0'+shi
        let fen = parseInt(cha/1000/60%60)
        fen = fen>=10?fen:'0'+fen
        let miao = parseInt(cha/1000%60)
        miao = miao>=10?miao:'0'+miao
        let div = document.querySelector('div')
        div.innerHTML = day+'天'+shi+'时'+fen+'分'+miao+'秒'
    }
    get()
    setInterval(get,1000)
</script>